package com.guguju.ssms.core.base;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

//import butterknife.ButterKnife;

/**
 * Created by dell on 2022-5-14.
 */
public abstract class BaseFragment extends Fragment {

    protected View rootView;

    /**
     * 返回当前fragment 的layout id
     *
     * @return layout id
     */
    protected abstract int getLayoutId();

    /**
     * 初始化完成之后调用,子类可以做一些初始化的操作
     */
    protected abstract void afterCreate();

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        if (rootView == null) {
            rootView = inflater.inflate(getLayoutId(), container, false);
        }
        //ButterKnife.bind(this, rootView);
        return rootView;
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        afterCreate();
    }

}
